<table class="table table-border table-bordered table-hover table-bg">
	<thead>
		<tr class="text-c">
			<th>编号</th>
			<th>合同编号</th>
			<th>使用状态</th>
			<th>生成时间</th>
			<th>合同状态</th>
			<th>操作员</th>
		</tr>
	</thead>
	<tbody>
		<?php if(is_array($list) && count($list)){ ?>
		<?php foreach($list as $k=>$ls){ ?>
		<tr class="text-c">
			<td><?php echo ($page-1)*C('PAGE_SIZE') + ($k+1); ?></td>
			<td>{$ls['contract']}</td>
			<td>{$ls['status'] == 1 ? '已使用' : '未使用'}</td>
			<td><?php echo date('Y-m-d', $ls['createtime']); ?></td>
			<td>
				<span class="select-box radius" style="width: 80px">
				  	<select class="select mstatus" size="1" user_id="{$ls['contract_id']}">
					  	<option value="1" <?php echo $ls['visible'] == 1 ? 'selected' : ''; ?>>可用</option>
					  	<option value="0" <?php echo $ls['visible'] == 0 ? 'selected' : ''; ?>>不可用</option>
				  	</select>
				</span>		
			</td>
			<td>{$ls['admin_nick']}</td>
		</tr>
		<?php } }else{ ?>
		<tr class="text-c">
			<td colspan="19" >暂无数据...</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<!--page-->
<include file="Common/page" />
<script>
	$(document).ready(function(){
		$(".mstatus").on('change', function(){
			var obj = $(this);
				id = obj.attr('user_id');
				status = obj.val();
			var load = layer.load(2);
			$.post('contractrem.html', {cid: id, status: status}, function(rs){
				layer.close(load);
				if(rs/1){
					layer.msg('设置成功', {icon:1,time: 2000});
				}else{
					layer.msg('设置失败', {icon:2,time: 2000});
				}
			});
		});
	});
</script>